
package models.spider.sink;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import models.spider.ISpider;
import models.spider.request.Request;

/**
 * 
 * @author laurent@opprecht.info
 */
public class Broadcast extends SinkBase {

    protected List<ISink> sinks = new ArrayList<ISink>();

    public Broadcast() {
    }

    public Broadcast(final List<ISink> sinks) {
        this.sinks.addAll(sinks);
    }

    public Broadcast(final ISink... sinks) {
        this.sinks.addAll(Arrays.asList(sinks));
    }

    public List<ISink> getSinks() {
        return sinks;
    }

    @Override
    public void sink(final Request object, final ISpider spider) {
        for (ISink sink : sinks) {
            sink.sink(object, spider);
        }
    }

}
